package com.sunshine.simplehospital.bean

import android.content.Context

/**
 * Created by sunshine on 2020/4/28
 */

class SimpleHospitalRepository(context: Context) {

    private val simpleHospitalDao: SimpleHospitalDao?

    init {
        val database = SimpleHospitalDatabase.getDatabase(context)
        simpleHospitalDao = database.simpleHospitalDao
    }

    fun getAllUser(): List<User>? {
        return simpleHospitalDao?.allUser
    }

    fun getUserRegister(userId: String): List<Register>? {
        return simpleHospitalDao?.userRegister(userId)
    }

    fun insertUser(user: User){
        simpleHospitalDao?.insertUser(user)
    }

    fun insertRegister(register: Register){
        simpleHospitalDao?.insertRegister(register)
    }

    fun updateUser(user: User){
        simpleHospitalDao?.updateUser(user)
    }

    fun updateRegister(register: Register){
        simpleHospitalDao?.updateRegister(register)
    }

    fun deleteUser(user: User){
        simpleHospitalDao?.deleteUser(user)
    }

    fun deleteRegister(register: Register){
        simpleHospitalDao?.deleteRegister(register)
    }

    fun getUser(userId: String): List<User>? {
        return simpleHospitalDao?.getUser(userId)
    }
}